package com.cgbl.cg.adapter

import com.cgbl.cg.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.robot.base.utils.pic.ImageLoaderUtils

class WorksListAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.app_item_works_list) {
    override fun convert(holder: BaseViewHolder, item: String) {
        holder.setText(R.id.item_tv_num, "${holder.adapterPosition + 1}")
        when (holder.adapterPosition) {
            0 -> {
                holder.setImageResource(R.id.item_iv_num, R.mipmap.app_ic_works_1)
                    .setGone(R.id.item_iv_num, false)
                    .setGone(R.id.item_tv_num, true)
            }
            1 -> {
                holder.setImageResource(R.id.item_iv_num, R.mipmap.app_ic_works_2)
                    .setGone(R.id.item_iv_num, false)
                    .setGone(R.id.item_tv_num, true)
            }
            2 -> {
                holder.setImageResource(R.id.item_iv_num, R.mipmap.app_ic_works_3)
                    .setGone(R.id.item_iv_num, false)
                    .setGone(R.id.item_tv_num, true)
            }
            else -> {
                holder.setBackgroundResource(R.id.item_tv_num, R.mipmap.app_ic_works_4)
                    .setGone(R.id.item_iv_num, true)
                    .setGone(R.id.item_tv_num, false)
            }
        }
        ImageLoaderUtils.displayCirclePortrait(
            context,
            holder.getView(R.id.item_iv_avatar),
            R.mipmap.app_ic_qq
        )
    }
}